package Demo12;

class EagerSingleton {

    // 类加载时直接初始化实例
    private static final EagerSingleton instance = new EagerSingleton();

    // 私有构造函数
    private EagerSingleton() {

    }

    // 提供全局访问点
    public static EagerSingleton getInstance() {
        return instance;
    }

}

public class Demo12 {

    public static void main(String[] args) {
        //EagerSingleton e3 = new EagerSingleton();
    }
}
